<template>
	<view class="social">
		<comHead :title="'我的群聊'" :isLeft="true" :isRight="false"></comHead>
		<view class="contentBox">
			<view class="searchBox">
				<image src="https://siha.vxmeng.com/static/social/search.png" mode="widthFix"></image>
				<input type="text" :placeholder="$t('sjzx.ss')" v-model="search" />
			</view>
			<view class="list">
				<view class="item" v-for="(item,index) in userQunList" @click="comLink('/pages/social/chat?id='+item.id+'&isQun=2')">
					<view class="l">
						<image class="img" src="https://siha.vxmeng.com/static/social/message.png" mode="widthFix"></image>
						<view class="text">
							<view class="time">
								<label>
									<text>{{item.name}}（{{item.num}}人）</text>
								</label>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				search: "",
				userQunList: []
			}
		},
		onShow() {
			this.getUserQunList()
		},
		methods: {
			async getUserQunList() {
				const res = await this.$myRequest({
					url: 'api/qun/getUserQunList',
					data: {}
				})
				if (res.code == 1) {
					console.log(res)
					this.userQunList = res.data
				}
			}
		}
	}
</script>

<style lang="less" scoped>
	.social {
		display: flex;
		flex-direction: column;
		// align-items: center;
		width: 100%;

		.tabs {
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-bottom: 30rpx;

			.item {
				display: flex;
				align-items: center;
				justify-content: center;
				width: 50%;

				text {
					display: inline-flex;
					color: #D8D8D8;
					font-size: 28rpx;
					border-bottom: 4rpx solid rgba(#000, 0);
					padding: 10rpx 0;

					&.on {
						color: #fff;
						// font-size: 32rpx;
						border-bottom: 4rpx solid #D8D8D8;
					}
				}
			}
		}

		.contentBox {
			display: flex;
			flex-direction: column;
			align-items: center;
			width: 670rpx;
			margin-left: 40rpx;

			.searchBox {
				width: 100%;
				height: 68rpx;
				flex-shrink: 0;
				background: rgba(#767B82, 0.3);
				border-radius: 40rpx;
				display: flex;
				align-items: center;
				padding: 0 30rpx;
				box-sizing: border-box;

				image {
					width: 29rpx;
					margin-right: 20rpx;
				}

				input {
					color: #fff;
					font-size: 28rpx;
				}
			}

			.list {
				width: 100%;
				padding-bottom: 120rpx;
				height: calc(100vh - 100rpx);
				overflow: auto;

				.item {
					display: flex;
					align-items: center;
					// justify-content: space-between;
					width: 100%;
					padding: 30rpx 0;
					border-bottom: 2rpx solid #292929;

					>text {
						color: #fff;
						font-size: 32rpx;
					}

					.l {
						display: flex;
						align-items: center;
						width: 70%;
						margin-left: 20rpx;

						.img {
							width: 86rpx;
							height: 86rpx;
							border-radius: 50%;
							background: #FAA03E;
							display: flex;
							align-items: center;
							justify-content: center;

							image {
								width: 45rpx;
							}
						}

						.text {
							display: flex;
							flex-direction: column;
							margin-left: 20rpx;
							width: 80%;

							.time {
								display: flex;
								align-items: center;
								justify-content: space-between;
							}

							text {
								color: #fff;
								font-size: 32rpx;

								&:nth-child(2) {
									font-size: 24rpx;
									color: #999999;
									margin-top: 10rpx;
								}
							}

							.slh {
								font-size: 24rpx;
								color: #999999;
								margin-top: 10rpx;
							}
						}
					}

					.r {
						display: flex;
						align-items: center;

						.show {
							width: 140rpx;
							height: 60rpx;
							border-radius: 182rpx;
							background: linear-gradient(270deg, #5F58FD 0%, #62B6FC 100%);
							font-size: 28rpx;
							color: #fff;
							display: flex;
							align-items: center;
							justify-content: center;
						}

						>text {
							color: #666;
							font-size: 28rpx;
						}
					}
				}
			}
		}

		.bottom {
			position: fixed;
			left: 0;
			bottom: 0;
			width: 750rpx;
			height: 120rpx;
			background: #1C2128;
			display: flex;
			align-items: center;
			justify-content: flex-end;
			padding: 0 30rpx;
			box-sizing: border-box;

			text {
				display: inline-flex;
				width: 140rpx;
				height: 60rpx;
				border-radius: 200rpx;
				background: #4A525E;
				align-items: center;
				justify-content: center;
				color: #BBBDBF;

				&.on {
					background: linear-gradient(290deg, #62B6FC 0%, #5F58FD 76%, #5F58FD 98%);
					color: #fff;
				}
			}
		}
	}
</style>